<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>高级接口</title>
</head>
<body>
<?php 
   include "access_token.php";
   
   //请求高级接口
   $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$access_token;
   
   $result = https_request($url, $jsonmenu);
   
   var_dump($result);

   function https_request($url,$data = null){
	   
   $curl = curl_init();
   
   curl_setopt($curl, CURLOPT_URL, $url);
   
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
   
   curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
   
   if (!empty($data)){
	   
        curl_setopt($curl, CURLOPT_POST, 1);
		
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
	
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
	
    $output = curl_exec($curl);
	
    curl_close($curl);
	
    return $output;
	
}

  
  
  //高级接口之自定义菜单
  
  $jsonmenu = '{
      "button":[
      {
            "name":"扫码",
			
			"sub_button":[
			{
				
				"type":"scancode_waitmsg",
				"name":"扫码带提示",
				"key":"rselfmenu_0_0"
			},
			{
			    "type":"scancode_push",
                "name":"扫码推事件",
                "key":"rselfmenu_0_1"			
				
			}]
      

       },
       {
           "name":"公司介绍",
		   
		   "type":"view",
		   
		   "url":"http://beebeebee.net"

       }]
 }';

   ?>
</body>
</html>
